<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>v-on 实例</title>
	<script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
	<h1>v-on 实例</h1>
	<hr>
	<div id="app">
		本场比赛得分：{{fenshu}}
		<p>
			<button v-on:click="jiafen">加分</button>
			<button @click="jianfen">减分</button><br/>
			<input type="text" v-on:keyup.13="onEnter" v-model="fenshu2">
		</p>
	</div>

	<script type="text/javascript">
		var app = new Vue({
			el:'#app',	
			data:{
				fenshu:0,
				fenshu2:1,
			},
			methods:{
				jiafen:function(){
					this.fenshu++;
				},
				jianfen:function(){
					this.fenshu--;
				},
				onEnter:function(){
					this.fenshu=this.fenshu+parseInt(this.fenshu2);
				}
			}
		})
	</script>
</body>
</html>